import request from '@/utils/request'

const tableConfigApi = {
  findsByMenuId(menuId, groupId) {
    return request({
      url: `/admin/fields/findsByMenuCode/${menuCode}`,
      method: 'get',
      params: {
        groupId: groupId
      }
    })
  },
  updateField(field) {
    return request({
      url: `/admin/fields/update`,
      method: 'post',
      data: field
    })
  },
  insertField(field) {
    return request({
      url: `/admin/fields/insert`,
      method: 'post',
      data: field
    })
  },
  deleteField(id) {
    return request({
      url: `/admin/fields/delete`,
      method: 'get',
      params: {
        'id': id
      }
    })
  },
  /**
   * 自定义表单列
   * @param field
   * @returns {AxiosPromise}
   */
  saveCustomTableColumn(customColumn) {
    return request({
      url: `/admin/dynTable/customTableColumn`,
      method: 'post',
      data: customColumn
    })
  },
}

export default tableConfigApi
